import { post, fetchModuleData, postModuleData } from '@/api/service';
import { getCurrentData } from '@/utils/data';

// const rootPath = 'app/api/target';
// const url = 'transhipmentTraffic/bigshow/common';
// const downUrl = 'transhipmentTraffic/bigshow/downExcel';

export default {
  // 接口模板
  someApi: () => post('/123'),
  /** ----------------------------中转双十一--战场首页---------------------------- */

  // 审批 列表
  getMessageList: (
    statuskey: string,
    statuscode: string,
    type: string, // handing  处理中 handed 处理完成 myApproval 我的审批
    startLine: number,
    count: number,
  ) => fetchModuleData('getMessageList', {
    statuskey,
    statuscode,
    type,
    startLine,
    count,
  }),
  // 工作任务列表
  getNC63TaskList: (
    groupId: string,
    userid: string,
    detail: string,
  ) => fetchModuleData('getNC63TaskList', {
    groupId,
    userid,
    detail,
  }),
  // 2019-04-22 新的审批详情接口
  getTempletData: (
    userid: string,
    msgId: string,
  ) => fetchModuleData('getTempletData', {
    userid,
    msgId,
  }),
  // 单据 详情
  getMessageDetail: (
    userid: string,
    msgId: string,
  ) => fetchModuleData('getMessageDetail', {
    userid,
    msgId,
  }),
  // 审批历史
  approveHistoryList: (
    userid: string,
    detail: string,
  ) => fetchModuleData('getApproveHistoryList', {
    userid,
    detail,
  }),
  // 获取单据 流程图
  getTaskFlowChart: (
    userid: string,
    detail: string,
    workflowType: string,
  ) => fetchModuleData('getTaskFlowChart', {
    userid,
    detail,
    workflow_type: workflowType,
  }),
  // 单据审批 详情 审批的流程啊 记录啊
  approvalDetails: (
    groupId: string,
    userid: string,
    detail: string,
  ) => fetchModuleData('approvalDetails', {
    groupId,
    userid,
    detail,
  }),
  // 审批单据
  getWhetherApprove: (
    groupId: string,
    userid: string,
    detail: string,
    sign: string,
    node: string = '',
    userids: string = '',
  ) => fetchModuleData('getWhetherApprove', {
    groupId,
    userid,
    detail,
    sign,
    node,
    userids,
  }),
  // 取消审批单据
  getUnApprove: (
    groupId: string,
    userid: string,
    detail: string,
  ) => fetchModuleData('getUnApprove', {
    groupId,
    userid,
    detail,
  }),
  // 审批单据-- 驳回
  getdoReject: (
    groupId: string,
    userid: string,
    detail: string,
    nodeId: string, // 驳回人 id
    node: string, // 驳回意见
  ) => fetchModuleData('getdoReject', {
    groupId,
    userid,
    detail,
    nodeId,
    node,
  }),
  // 统一的审批接口
  doAction: (
    userid: string,
    taskid: string,
    note: string,
    action: string,
    nodeid: string,
    targetUserlist?: string,
    msgSenders?: string,
  ) => postModuleData('doAction', {
    userid,
    taskid,
    note,
    action,
    nodeid,
    targetUserlist,
    msgSenders,
  }),
  // 登录
  loginByUsername: (
    userName: string,
    userPass: string,
  ) => fetchModuleData('loginByUsername', {
    userName,
    userPass,
  }),
};
